/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/** *****************************************************************************************************
 *  \file     Uart.h                                                                                    *
 *  \brief    This file contains interface header for UART MCAL driver.                                 *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date           <th>Version                                                                   *
 * <tr><td>2024/10/29     <td>1.0.0                                                                     *
 * </table>                                                                                             *
 *******************************************************************************************************/

#ifndef UART_H
#define UART_H

#ifdef __cplusplus
extern "C" {
#endif

/********************************************************************************************************
 *                                      Include header files                                            *
 *******************************************************************************************************/
#include "Uart_Types.h"
#include "Uart_Cfg.h"

/********************************************************************************************************
 *                                  Global Variable Declarations                                        *
 *******************************************************************************************************/
extern const Uart_ConfigType Uart_Config;

/********************************************************************************************************
 *                                  Global Function Declarations                                        *
 *******************************************************************************************************/
void Uart_Init(const Uart_ConfigType * Config);
void Uart_Deinit(void);
Std_ReturnType Uart_SetBaudrate(uint8 Channel, Uart_BaudrateType Baudrate);
Std_ReturnType Uart_GetBaudrate(uint8 Channel, Uart_BaudrateType * Baudrate);
Std_ReturnType Uart_SyncSend(uint8 Channel, const uint8* Buffer, uint32 BufferSize, uint32 Timeout);
Std_ReturnType Uart_SyncReceive(uint8 Channel, uint8* Buffer, uint32 BufferSize, uint32 Timeout);
Std_ReturnType Uart_AsyncSend(uint8 Channel, const uint8* Buffer, uint32 BufferSize);
Std_ReturnType Uart_AsyncReceive(uint8 Channel, uint8* Buffer, uint32 BufferSize);
Std_ReturnType Uart_StartRealTimeRecv(uint8 Channel);
Std_ReturnType Uart_StopRealTimeRecv(uint8 Channel);
void Uart_Abort(uint8 Channel, Uart_DataDirectionType DirectionType);
Uart_StatusType Uart_GetStatus(uint8 Channel, uint32 *BytesTransfered, Uart_DataDirectionType DirectionType);
void Uart_GetVersionInfo(Std_VersionInfoType * versioninfo);

extern ISR(Uart_Irq1Handler);
extern ISR(Uart_Irq2Handler);
extern ISR(Uart_Irq3Handler);
extern ISR(Uart_Irq4Handler);
extern ISR(Uart_Irq5Handler);
extern ISR(Uart_Irq6Handler);
extern ISR(Uart_Irq7Handler);
extern ISR(Uart_Irq8Handler);
extern ISR(Uart_Irq9Handler);
extern ISR(Uart_Irq10Handler);
extern ISR(Uart_Irq11Handler);
extern ISR(Uart_Irq12Handler);
extern ISR(Uart_Irq13Handler);
extern ISR(Uart_Irq14Handler);
extern ISR(Uart_Irq15Handler);
extern ISR(Uart_Irq16Handler);
extern ISR(Uart_Irq17Handler);
extern ISR(Uart_Irq18Handler);
extern ISR(Uart_Irq19Handler);
extern ISR(Uart_Irq20Handler);

#ifdef __cplusplus
}
#endif

#endif /* UART_H */

/* End of file */
